#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    bool isValidSudoku(vector<vector<char>>& board) {
        vector<vector<bool>> row(9, vector<bool>(10, false)), col(9, vector<bool>(10, false));
        vector<vector<vector<bool>>> gride(3, vector<vector<bool>>(3, vector<bool>(10, false)));

        for (int i = 0; i < 9; i++)
            for (int j = 0; j < 9; j++)
            {
                if (board[i][j] != '.')
                {
                    int num = board[i][j] - '0';
                    if (row[i][num] || col[j][num] || gride[i / 3][j / 3][num])
                        return false;
                    row[i][num] = col[j][num] = gride[i / 3][j / 3][num] = true;
                }
            }
        return true;
    }
};